#ifndef __TURNERS_H
#define __TURNERS_H

#include "../common/common_motor.h"
#include "../common/device_manager.h"
#include "../../bsp/bsp.h"


#define TURNERS_angle_speed 15      //转向器转动速度，单位：度/秒
#define TURNERS_ratio       100     //转向器减速机比例 turners:motor
#define TURNERS_part        10000   //转向器电机细分

//input
#define TURNERS_io_down     6       //转向下限位
#define TURNERS_io_origin   7       //转向待机位
#define TURNERS_io_top      8       //转向上限位

#define TURNERS_io_touch    0       //转向io触发状态
//output
#define TURNERS_io_locker 10    //抱闸

/**************************function extern***********************/
//outside api
extern int xp_turners_init();  //turners object init
extern int xp_turner_convert_speed(u8 angle_speed);    //change angle speed to motor speed
extern int xp_turners_move_support_retry(s8 angle,u8 speed_block,u8 retry_cnt);
extern int xp_turners_move(s8 angle,u8 speed_block);    //turners move
extern int xp_turner_check_zero(void); //turners check zero
extern int xp_turners_get_encode(void); //get turners motor encode
extern int xp_turners_get_location(void);   //get turners location base on encode
extern int xp_turners_as_zero(void);    //set as zero point
extern void xp_turners_zero_clear(void);    //clear zero recode
extern int xp_turner_angle_get(void);   //get turner angle
extern int xp_turner_move_to_angle(int angle);  //turner move a angle

extern void xp_turners_io_event(u32 event); //turners io touch event deal with

extern int xp_turners_debug(char *type,char *fun,char *param);

#endif
//end of the file
